package com.yanyun.yczyy.api.controller;

import com.yanyun.yczyy.api.entities.EnergyUsedView;
import com.yanyun.yczyy.api.entities.TblIOData;
import com.yanyun.yczyy.api.repository.IDynamicDataRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class DynamicDataController {
    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/supplyAirTemperature")
    public List<TblIOData> supplyAirTemperature() {
        return dynamicDataRepository.supplyAirTemperature();
    }

    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/returnAirTemperature")
    public List<TblIOData> returnAirTemperature() {
        return dynamicDataRepository.returnAirTemperature();

    }

    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/yiYanWaterUsed")

    public List<EnergyUsedView> yiYanWaterUsed() {
        return dynamicDataRepository.yiYanWaterUsed();

    }

    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/menZhenWaterUsed")
    public List<EnergyUsedView> menZhenWaterUsed() {
        return dynamicDataRepository.menZhenWaterUsed();

    }

    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/co1Concentration")
    public List<TblIOData> co1Concentration() {
        return dynamicDataRepository.co1Concentration();

    }

    @CrossOrigin(origins = {"*"})
    @GetMapping("/platform-api/energy/co2Concentration")
    public List<TblIOData> co2Concentration() {
        return dynamicDataRepository.co2Concentration();

    }

    @Autowired
    IDynamicDataRepository dynamicDataRepository;
}
